<?php
require_once('mysql_connect.php');
if ($_SESSION['admin'] == 1){
}else{
	header("Location:login.php");
	exit();
}

$loc ="admin";


if(isset($_GET['del'])){
	$query = "UPDATE users SET admin=0 WHERE id=" . $_GET['del'];
	$result = mysql_query($query);
}
if(isset($_GET['add'])){
	$query = "UPDATE users SET admin=1 WHERE id=" . $_GET['add'];
	$result = mysql_query($query);
}


$pullquery = "SELECT * FROM users WHERE admin=1";
$pullresult = mysql_query($pullquery);
$pullquerytwo = "SELECT * FROM users WHERE admin=0";
$pullresulttwp = mysql_query($pullquerytwo);
include('top.php');
?>
<TABLE><TR><TD>
<?php
while($pullrow = mysql_fetch_array($pullresult)){
?>
<BR><FONT FACE="Verdana" size=-1 color=000000>email: <?php echo unescape_data($pullrow['email']);?> (<A HREF="makeadmin.php?del=<?php echo $pullrow['id'];?>"><FONT FACE="Verdana" size=-1 color=000000>make normal</FONT></A>)</FONT>
<?php
}
?>
<BR><HR width="100%">
<?php
while($pullrowtwo = mysql_fetch_array($pullresulttwp)){
?>
<BR><FONT FACE="Verdana" size=-1 color=000000>email: <?php echo unescape_data($pullrowtwo['email']);?> (<A HREF="makeadmin.php?add=<?php echo $pullrowtwo['id'];?>"><FONT FACE="Verdana" size=-1 color=000000>make admin</FONT></A>)</FONT>
<?php
}
?>

</TD></TR></TABLE>
<?php
include('bot.php');
?>